<%@page import="com.xbk.jtable.ui.HtmlUtil"%>
<%@page import="com.xbk.jtable.ui.jForm"%>
<%@page import="com.xbk.jtable.ui.jTableUtil"%>
<%@page import="com.xbk.platform.DataMap"%>
<%@page import="com.xbk.util.StringUtil"%>
<%@page import="com.xbk.jtable.ui.Widget"%>
<%@page import="com.xbk.jtable.ui.jTable"%>
<%@page import="com.xbk.platform.DaoUtil"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%@include file="/Include/include.jspf"%>
<style type="text/css">
</style>
<%
	DaoUtil du = ConnectionMananger.getDaoUtil();
	String sTableName = request.getParameter("TableName");
	
	String jtableData = "";
	DataMap inter = new DataMap(); 
	
	String sSql = "SELECT * FROM DCP_JTABLE_STYLE WHERE UPPER(TABLE_NAME) LIKE  UPPER('%"+sTableName+"%')";
	jTable jtable = new jTable(du);
	jtable.setKeyCols("TABLE_NAME,COL");
	jtable.setRelativeTable("DCP_JTABLE_STYLE");
	jtable.initBySql(sSql);
	jtable.setHeader(du.getCols(sSql));
	jtableData = jtable.getHtml();
	
	du.close();
%>
</head>
<body>
<!-- top -->
<div id="top">
	<%@include file="/top.jsp" %>
</div>
<form class="ml20 form-inline" action="jTableStyleList.jsp" method="get">
<%=HtmlUtil.getSelectOptions("SELECT DISTINCT TABLE_NAME AS K,NVL(TABLE_COMMENT,TABLE_NAME) AS V FROM DCP_JTABLE_STYLE","选择一张表", "tableName2", "tableName2", sTableName) %>
<label for="tableName">或者
<input type="text" name="TableName" class="mb0" placeholder="输入一个表名查询,支持模糊">
<button class="btn btn-info">确定</button>
</label>
</form>
<!-- content -->
<div id="jtableContainer" class="mg20 mt100 mb0"></div>
</body>
<script type="text/javascript">
$(function() {
	$(function(){
		var jtable = new jDcp.web.Table();
		jtable.parse("<%=jtableData %>");
		jtable.appendTo("jtableContainer");
		$(".jtable-container").css("height",(($(window).height() - $(".jtable-container").offset().top) - 25) + "px");
		
		$("#tableName2").change(function(){
			var TableName = $(this).val();
			if(TableName != "选择一张表"){
				window.location.replace("jTableStyleList.jsp?TableName="+TableName+"&rand="+Util.getRandom());
			}
		});
	});
});
</script>
</html>